package com.api.shopapi.mapper;

import com.api.shopapi.entity.NursingRecordImg;
import com.api.shopapi.entity.NursingRecordPosition;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface NursingRecordImgMapper {

    @Insert("insert into nursing_record_img " +
            "(" +
            "NursingRecordImgCode," +
            "NursingRecordCode," +
            "ImgPath," +
            "CreateTime," +
            "Status" +
            ")values (" +
            "#{nursingRecordImg.NursingRecordImgCode} ," +
            "#{nursingRecordImg.NursingRecordCode} ," +
            "#{nursingRecordImg.ImgPath}," +
            "#{nursingRecordImg.CreateTime}," +
            "#{nursingRecordImg.Status})")
    int insert(@Param("nursingRecordImg") NursingRecordImg nursingRecordImg);


    @Delete("delete from nursing_record_img where nursingRecordImgCode=#{nursingRecordImgCode} ")
    int delete(@Param("nursingRecordImgCode") String nursingRecordImgCode);

    @Update("update nursing_record_img" +
            " set" +
            " Status=#{nursingRecordImg.Status} " +
            " where NursingRecordImgCode=#{nursingRecordImg.NursingRecordImgCode} ")
    int update(@Param("nursingRecordImg") NursingRecordImg nursingRecordImg);

    @Select("select * from nursing_record_img where nursingRecordImgCode=#{nursingRecordImgCode} limit 1")
    NursingRecordImg getByNursingRecordImgCode(@Param("nursingRecordImgCode") String nursingRecordImgCode);

    @Select("select  * from nursing_record_img where nursingRecordCode=#{nursingRecordCode} order by CreateTime desc")
    List<NursingRecordImg> listByNursingRecordCode(@Param("nursingRecordCode") String nursingRecordCode);


}
